/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package orgarqsindex;

import java.util.Random;

/**
 *
 * @author Fernando Molon Toigo e Dyoni Bertuol
 */
public class RandomGenerator {
    
    Random r;
    String[] maleFirstNamesList;
    String[] femaleFirstNamesList;
    String[] streetTypesList;
    String[] streetNamesList;

    public RandomGenerator() {
        r = new Random();
        
        String[] commonMaleFirstNames = {"Silvio", "Ronaldo", "Gustavo",
            "Daniel", "Martim", "Sérgio", "Paulo", "Leandro", "Túlio", 
            "Gaspar", "Rodolfo", "Adão", "Leonardo", "Jaime", "Rafael",
            "Bruno", "Bernardo", "João", "Pedro", "Manuel", "Fernando",
            "Marcelo", "Marcos", "Alex"};
        maleFirstNamesList = commonMaleFirstNames; 
        
        String[] commonFemaleFirstNames = {"Rosa", "Íris", "Bárbara", "Edite",
            "Olga", "Vanessa", "Júlia", "Juliana", "Ana", "Isabel", "Inês",
            "Lígia", "Fabiana", "Andréia", "Tereza", "Marina", "Alexandra",
            "Isaura", "Maria", "Priscila", "Tatiana", "Manoela", "Helena",
            "Natália", "Sofia"};
        femaleFirstNamesList = commonFemaleFirstNames; 
        
        String[] commonStreetTypes = {"R.","Av."};
        streetTypesList = commonStreetTypes;
        
        String[] commonStreetNames = {"Ângelo", "Júlio de Castilhos", "Marquês",
            "20 de Setembro", "18 do Forte", "Sinimbu", "Brasil", "Praiana"};
        streetNamesList = commonStreetNames;
    }   
    
    public long generateRandomLong() {
        return r.nextLong();
    }    
    
    public double generateRandomDouble() {
        return r.nextDouble();
    }
    
    public String generateRandomFirstName(char sex) {
        if (sex == 'M') {
            return maleFirstNamesList[r.nextInt(maleFirstNamesList.length)];
        }
        if (sex == 'F') {
            return femaleFirstNamesList[r.nextInt(femaleFirstNamesList.length)];
        }
        return null;
    }

    public String generateAddress() {
        String streetType = streetTypesList[r.nextInt(streetTypesList.length)];
        String streetName = streetNamesList[r.nextInt(streetNamesList.length)];
        int number = r.nextInt(1000); //limita o número em 4 dígitos
        return streetType + " " + streetName + ", " + number;
    }

    public int generatePositiveRandomInt(int max) {
        return r.nextInt(max);
    }
    
}
